<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>

<form id="fileUpload" action="/upload" enctype="multipart/form-data" method="POST">
    <p><input id="file" type="file" name="file"/></p>
    <p><input type="submit" value="确认提交"></p>
</form>

<button>
    <a href="/fileInfoList">展示最近上传的文件的信息</a><br/>
</button>

<div th:if="${fileInfo} ne null">
    <h3>当前上传文件的信息</h3>
    <table border="1">
        <thead>
        <tr>
            <th>原始文件名</th>
            <th>文件大小</th>
            <th>文件类型</th>
            <th>创建时间</th>
            <th>保存地址</th>
            <th>数字信封</th>
            <th>下载</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td th:text="${fileInfo.getFileOriName()}"></td>
            <td th:text="${fileInfo.getFileSize()}"></td>
            <td th:text="${fileInfo.getFileType()}"></td>
            <td th:text="${fileInfo.getCreateTime()}"></td>
            <td th:text="${fileInfo.getSavePath()}"></td>
            <td th:text="${fileInfo.getEnvelope()}"></td>
            <td><a th:href="'/download?uuid='+${fileInfo.getUuid()}" target="_self">下载</a></td>
        </tr>
        </tbody>
    </table>
</div>

<div th:if="${fileInfoList} ne null">
    <h3>最近上传的文件信息</h3>
    <table border="1">
        <thead>
        <tr>
            <th>原始文件名</th>
            <th>文件大小</th>
            <th>文件类型</th>
            <th>创建时间</th>
            <th>保存地址</th>
            <th>数字信封</th>
            <th>下载</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="item:${fileInfoList}">
            <td th:text="${item.getFileOriName()}"></td>
            <td th:text="${item.getFileSize()}"></td>
            <td th:text="${item.getFileType()}"></td>
            <!--在前端格式化时间-->
            <td th:text="${#dates.format(item.getCreateTime(),'yyyy-MM-dd HH:mm:ss')}"></td>
            <td th:text="${item.getSavePath()}"></td>
            <td th:text="${item.getEnvelope()}"></td>
            <td><a th:href="'/download?uuid='+${item.getUuid()}" target="_self">下载</a></td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>